﻿<%@ page language="C#" autoeventwireup="true" inherits="Training.Web.Forms.Administration.Catalog.PelatihanDetailForm, App_Web_r3kxljgh" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>City Form</title>
    <script src="<%= ResolveUrl("~/scripts/jquery.validate.min.js") %>" type="text/javascript"></script>
    <script src="<%= ResolveUrl("~/scripts/jquery.validate.wrapper.js") %>" type="text/javascript"></script>
    <script src="<%= ResolveUrl("~/scripts/jquery.inputmask.bundle.min.js") %>" type="text/javascript"></script>
    <script src="<%= ResolveUrl("~/scripts/jquery.msgBox.v1.js") %>" type="text/javascript"></script>
    <script src="<%= ResolveUrl("~/scripts/chosen/chosen.jquery.min.js") %>" type="text/javascript"></script>
    <link href="<%= ResolveUrl("~/styles/chosen/chosen.min.css") %>" rel="stylesheet"
        type="text/css" />
    <script type="text/javascript">

        $("#btnSaveDetail").button({ icons: { primary: "ui-icon-disk"} });
        $("#btnCloseDetail").button({ icons: { primary: "ui-icon-close"} });

        $('#btnCloseDetail').click(function () {
            parent.$('#dialogDetail').dialog("close");
        });
 
    </script>
    <script type="text/javascript">

        $(document).ready(function () {


          

            // 1. prepare the validation rules and messages.
            var rulesDetail = {
                ddlNIK: "required"

            };
            var messagesDetail = {

                ddlNIK: "NIK Peserta wajib diisi !"

            };

           

            // 2. Initiate the validator
            var validatorDetail = new jQueryValidatorWrapper("formDetail", rulesDetail, messagesDetail);

            // 3. Set the click event to do the validation
            $("#btnSaveDetail").click(function () {

                if (!validatorDetail.validate())
                    return;

                var pesertaID = $("#ddlNIK option:selected").val();
                var objrecPeserta = new Object();
                objrecPeserta.PesertaID = pesertaID;

                jsonData = JSON.stringify(objrecPeserta);
                var handlerUrl = '<%= ResolveUrl("~/ajaxhandler/Transaction/PelatihanDetailHandler.ashx") %>';
                CallAjax(handlerUrl, "?method=settosession", jsonData);
                parent.$('#dialogDetail').dialog('close');
                setTimeout("parent.$('#tableDetail').trigger('reloadGrid');", 3000);

                return false;
            });



            $('#ddlNIK').change(function () {
                var handlerUrl = '<%= ResolveUrl("~/AjaxHandler/Loaddata/Administration/catalog/PesertaLoadHandler.ashx") %>';
                var pesertaID = $("#ddlNIK option:selected").val();
                if (pesertaID != "") {

                    $.ajax({
                        type: 'POST',
                        url: handlerUrl + "?method=getbyid&pesertaID=" + pesertaID,
                        contentType: 'application/json',
                        dataType: 'json',
                        success: function (datas) {
                            $("#txtNamaPeserta").val(datas.NamaPeserta);
                            $("#txtDepartemen").val(datas.Departemen);
                            $("#txtBagian").val(datas.Bagian);
                            $("#txtJabatan").val(datas.Jabatan);
                        },
                        error: function () {
                            $.msgBox("Error load peserta  !", null, { title: "Pesan Error" });
                        }
                    });

                    //END
                }
            });

        });
    
    </script>
    <script type="text/javascript">

        function ClearText() {
            $('#txtNamaPeserta').val('');
            $('#txtDepartemen').val('');
            $('#txtBagian').val('');
            $('#txtJabatan').val('');
        }
        
         
    </script>
    <script type="text/javascript">

        $(document).ready(function () {
            $('#<%= ddlNIK.ClientID %>').chosen({ placeholder_text_single: "-- pilih NIK --" });


        });

    </script>
</head>
<body onload="ClearText();">
    <form id="formDetail" runat="server">
    <table border="0">
        <tr>
            <td valign="top">
                NIK
            </td>
            <td valign="top">
                :
            </td>
            <td>
                <asp:DropDownList ID="ddlNIK" runat="server" Width="400">
                </asp:DropDownList>
                &nbsp;<span style="color: Red;">*</span>
            </td>
        </tr>
        <tr>
            <td valign="top">
                Nama
            </td>
            <td valign="top">
                :
            </td>
            <td>
                <%--<asp:DropDownList ID="ddlBagian" runat="server" Width="400"></asp:DropDownList> &nbsp;<span
                    style="color: Red;">*</span>--%>
                <asp:TextBox ID="txtNamaPeserta" ReadOnly="true" runat="server" Width="400"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td valign="top">
                Departemen
            </td>
            <td valign="top">
                :
            </td>
            <td>
               <%-- <asp:DropDownList ID="ddlJabatan" runat="server" Width="400">
                </asp:DropDownList>
                &nbsp;<span style="color: Red;">*</span>--%>
                  <asp:TextBox ID="txtDepartemen" ReadOnly="true" runat="server" Width="400"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td valign="top">
                Bagian
            </td>
            <td valign="top">
                :
            </td>
            <td>
               <%-- <asp:TextBox ID="txtNIK" MaxLength="100" runat="server" Width="300"></asp:TextBox>&nbsp;<span
                    style="color: Red;">*</span>--%>
                      <asp:TextBox ID="txtBagian" ReadOnly="true" runat="server" Width="400"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td valign="top">
               Jabatan
            </td>
            <td valign="top">
                :
            </td>
            <td>
                <%--<asp:TextBox ID="txtNama" MaxLength="100" runat="server" Width="300"></asp:TextBox>&nbsp;<span
                    style="color: Red;">*</span>--%>
                    <asp:TextBox ID="txtJabatan" ReadOnly="true" runat="server" Width="400"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td colspan="2">
                &nbsp;
            </td>
            <td>
                <%-- <br />
                <br />
                <br />
                <br />
                <br />
                <br />
                <br />
                <br />--%>
                <div style="text-align: right; padding-top: 10px;">
                    <button id="btnSaveDetail" type="button">
                        Save</button>
                    <button id="btnCloseDetail" type="button">
                        Close</button>
                </div>
            </td>
        </tr>
        <tr>
            <td colspan="2">
                &nbsp;
            </td>
            <td>
                <asp:HiddenField ID="hfID" runat="server" />
            </td>
        </tr>
    </table>
    </form>
</body>
</html>
